package org.fund.common.core.domain;

import lombok.Data;
import org.fund.common.core.model.RegisterBody;

import java.io.Serializable;

/**
 * @Author Moro
 * @Date 2022/3/8 21:24
 * @title BaseResult
 */
@Data
public class BaseResult<T> implements Serializable {
    public static final long serialVersionUID =-213214214124L;
    private Integer code;
    private String msg;
    private T data;

    public BaseResult(Integer code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public BaseResult(String msg) {
        this.msg = msg;
    }

    public static <T> BaseResult success(T data){
      return  new   BaseResult(200,"成功",data);
    }

    public static  BaseResult  error(int code, String msg) {
        return new BaseResult(code,msg,null);
    }

    public static <T> BaseResult error(int i, String msg, T data) {
        return new BaseResult(i,msg,data);
    }

    public static BaseResult error(String message) {
        return new BaseResult(message);
    }
}
